//
//  DanLi.m
//  Full_House
//
//  Created by 陈杰 on 15/6/5.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "DanLi.h"

@implementation DanLi

- (void)dealloc{
    [_title release];
    [_addressDic release];
    [_images release];
    [_phone release];
    [_myId release];
    [_userImage release];
    [super dealloc];
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    if ([key isEqualToString:@"addresses"]) {
        self.addressDic = [value firstObject];
    }if ([key isEqualToString:@"user"]) {
        self.phone = [value objectForKey:@"phone"];
        self.userImage = [[value objectForKey:@"userImage"] objectForKey:@"medium"];
    }
}
- (void)setValue:(id)value forKey:(NSString *)key{
    if ([key isEqualToString:@"images"]) {
        self.images = [value objectAtIndex:1];
    }
    else{
        [super setValue:value forKey:key];
    }
}


+ (NSMutableArray *)danLiArrWithDic:(NSMutableArray *)dicArr{
    NSMutableArray *danLiArr = [NSMutableArray array];
    for (NSDictionary *dic in dicArr) {
        DanLi *danLi = [[DanLi alloc] init];
        [danLi setValuesForKeysWithDictionary:dic];
        [danLiArr addObject:danLi];
    }
    return danLiArr;
    
}

@end
